#ifndef __CORE_VECTOR2__
#define __CORE_VECTOR2__
#include "Math.h"
namespace Core
{
	class rtVector2
	{
	public:
		float			x;
		float			y;

		rtVector2(void);
		explicit rtVector2(const float x, const float y);

		static rtVector2 vec2_origin;
		void 			set(const float x, const float y);
		void			zero(void);

		float			operator [] (int index) const;
		float&			operator [] (int index);
		rtVector2		operator - () const;
		float			operator * (const rtVector2 &a) const;
		rtVector2		operator * (const float a) const;
		rtVector2		operator / (const float a) const;
		rtVector2		operator + (const rtVector2 &a) const;
		rtVector2		operator - (const rtVector2 &a) const;
		rtVector2&		operator += (const rtVector2 &a);
		rtVector2&		operator -= (const rtVector2 &a);
		rtVector2&		operator /= (const rtVector2 &a);
		rtVector2&		operator /= (const float a);
		rtVector2&		operator *= (const float a);

		friend rtVector2	operator * (const float a, const rtVector2 b);

		bool			compare(const rtVector2 &a) const;
		bool			compare( const rtVector2 &a, const float epsilon ) const;
		bool			operator == (const rtVector2 &a) const;
		bool			operator != (const rtVector2 &a) const;

		float			length(void) const;
		float			lengthFast(void) const;
		float			lengthSqr( void) const;
		float			normalize(void);
		float			normalizeFast(void);
		rtVector2&		truncate(float length);
		void			clamp(const rtVector2 &min, const rtVector2 &max);
		void			snap(void);
		void			snapInt(void);

		int				getDimension(void) const;

		const float*	toFloatPtr(void) const;
		float*			toFloatPtr(void);

		void			lerp(const rtVector2 &v1, const rtVector2 &v2, const float l);
	};
}
#endif

